<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>{$title|default=''|htmlentities} – {$site.name|htmlentities}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta name="renderer" content="webkit">
    <meta name="keywords" content="{$keywords|htmlentities}">
    <meta name="description" content="{$description|htmlentities}">
    <link rel="shortcut icon" href="__CDN__/assets/img/favicon.ico" />
    <link href="/assets/css/frontend.css" rel="stylesheet">
    <link href="/assets/css/common.css" rel="stylesheet">
    <script type="text/javascript">
        var require = {
            config: JSON.parse('{$config|json_encode}')
        };
        const wdid = "{$cate['id']}";
        const wpid = "{$cate['pid']}";
    </script>
    <!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
    <!--[if lt IE 9]>
    <script src="__CDN__/assets/js/html5shiv.js"></script>
    <script src="__CDN__/assets/js/respond.min.js"></script>
    <![endif]-->
</head>

<body>
    <div id="app">
        <div id="loading" ref="loadNode">
            <div id="loading-center">
                <div id="loading-center-absolute">
                    <div class="object" id="object_four"></div>
                    <div class="object" id="object_three"></div>
                    <div class="object" id="object_two"></div>
                    <div class="object" id="object_one"></div>
                </div>
            </div>
        </div>
        <header class="header">
            <div class="header-container">
                <div class="header-left">
                    <div class="header-logo" @click="handle('/',false)">
                        <img src="__CDN__/assets/img/logo.png" alt="Logo" class="header-logo">
                        <span class="header-title">{$site.name|htmlentities}</span>
                    </div>
                    <nav class="header-nav">
                        <a href="javascript:;" @click="handle(item.url,item.is_login)" :class="item.url =='/'?`nav-item active`:`nav-item`" v-for="(item,index) in head">{{item.name}}</a>
                    </nav>
                </div>
                <div class="header-right"  v-if="user">
                    <i class="fa fa-list-alt header-icon" @click="handle('/notice',false)"></i>
                    <div class="user-info" data-toggle="dropdown">
                        <img :src="user.avatar || '__CDN__/assets/img/avatar.png'" class="user-avatar">
                        <span class="user-name">{{ user.nickname }}</span>
                    </div>
                    <ul class="dropdown-menu">
                        <!-- User image -->
                        <li class="user-header" @click="handle('/user/info')">
                            <img :src="user.avatar" class="img-circle" alt="">
                            <p>
                                <div>{{ user.nickname }}</div>
                                <small>闻道ID:{{user.id}}</small>
                            </p>
                        </li>
                        <li class="user-body">
                            <div class="user-list" @click="handle('/user/info')">
                                <div>我的资料</div>
                                <i class="fa fa-chevron-right"></i>
                            </div>
                            <div  class="user-list" @click="handle('/user/favorites')">
                                <div>我的收藏</div>
                                <i class="fa fa-chevron-right"></i>
                            </div>
                            <div class="user-list" @click="handle('/user/adviser')">
                                <div>我的实战</div>
                                <i class="fa fa-chevron-right"></i>
                            </div>
                        </li>
                        <li class="user-body">
                            <div class="user-list" @click="handle('/user/list')">
                                <div>榜单明细</div>
                                <i class="fa fa-chevron-right"></i>
                            </div>
                        </li>
                        <!-- Menu Footer-->
                        <li class="user-footer">
                            <div>
                                <a href="/user/logout"><i class="fa fa-sign-out"></i>
                                    {:__('Logout')}</a>
                            </div>
                        </li>
                    </ul>
                </div>
                <div class="header-right" v-else   @click="handle('/login',false)">
                    <i class="fa fa-list-alt header-icon" ></i>
                    <div class="user-info">
                        <i class="fa fa-user-circle fa-fw header-icon" style="margin-right: 5px;"></i>
                        <span class="user-name">登录</span>
                    </div>
                </div>
                
            </div>
        </header>
        <section class="banner">
            <div class="search-container">
                <div class="search-categories">
                    <a href="javascript:;" class="search-category active" @click="handle('/',false)">全部</a>
                    <a href="javascript:;" class="search-category"  @click="handle('/wfgroup',true)">闻风楼</a>
                    <a href="javascript:;" class="search-category"  @click="handle('/wpgroup',true)">三十六计</a>
                    <a href="javascript:;" class="search-category"  @click="handle('/adviser',true)">谋士</a>
                    <a href="javascript:;" class="search-category"  @click="handle('/resource',true)">资源库</a>
                </div>
                <div class="search-box">
                    <input type="text" class="search-input" placeholder="搜索..." v-model="searchQuery" @input="handleSearch" @keydown="handleKeyDown">
                    <button class="search-button" @click="submitSearch"><i class="fa fa-search"></i></button>
                    <div class="search-suggestions" v-if="suggestions.length && showSuggestions" style="z-index: 1000000;">
                        <div class="suggestion-item" v-for="(item, index) in suggestions" :key="index" @click="selectSuggestion(item)">
                            <div class="suggestion-title" v-html="item.text"></div>
                        </div>
                    </div>
                </div>
            </div>
            <div id="headerCarousel" class="carousel slide" data-ride="carousel" data-interval="2500" data-pause="hover">
                <!-- 指示器 -->
                <ol class="carousel-indicators">
                    <template v-for="(item,bi) in banner" :key="bi">
                        <li :data-target="'#headerCarousel'" :data-slide-to="bi" :class="{active: bi === 0}"></li>
                    </template>
                </ol>
            
                <!-- 轮播图片 -->
                <div class="carousel-inner">
                    <div :class="index==0?`item active`:`item`" v-for="(item,index) in banner"  @click="handle(item.url,item.is_login)">
                        <img :src="item.image" :alt="item.title">
                    </div>
                </div>
            
                <!-- 左右切换按钮 -->
                <a class="left carousel-control" href="#headerCarousel" data-slide="prev">
                    
                </a>
                <a class="right carousel-control" href="#headerCarousel" data-slide="next">
                    
                </a>
            </div>
        </section>
        <section class="container">
            <div class="row">
                <div class="col-md-2 hidden-xs">
                    <div class="sidebar-header">
                        <img src="/assets/img/logo.png" class="sidebar-avatar">
                        <span>闻钱有道</span>
                    </div>
                    <div class="category-menu">
                        <template v-for="(item,index) in wdcate">
                            <div class="category-item" v-if = "item.pid == 0">
                                <div :class="currentCategory == item.id?`category-header expanded`:`category-header`" @click=" currentCategory = item.id" >
                                    <img :src="item.image" width="20" height="20">
                                    <span>{{item.name}}</span>
                                    <i class="fa fa-angle-down"></i>
                                </div>
                                <div :class="currentCategory == item.id?`category-submenu show`:`category-submenu`">
                                    <template v-for="(itm,idx) in wdcate">
                                    <a href="javascript:;" :class="itemTab == itm.id?`submenu-item active`:`submenu-item`" @click="handCate(itm)" v-if="itm.pid == item.id">{{itm.name}}</a>
                                    </template>
                                </div>
                            </div>
                        </template>
                    </div>
                </div>
                <div class="col-md-7 col-xs-12">
                    <div class="content">
                        <div class="content-title">
                            <div class="tit-top">
                                <div class="tit-left">
                                    <img src="{$cate['image']|default='/assets/img/avatar.png'}">
                                    <div class="tit">
                                        <div  class="name">{$cate['name']}</div> 
                                        <div class="dec">{$total['user']}位精华帖作者，共{$total['document']}篇贴子</div>
                                    </div>
                                </div>
                                <div class="tit-right">
                                        <button type="button" class="btn btn-warning btn-ctd" @click="handleAdd()">
                                            <i class="fa fa-add"></i> 发布
                                        </button>
                                </div>
                            </div>
                            <div class="tit-bottom">
                                <i class="fa fa-star"></i>{$cate['description']}
                            </div>        
                        </div>
                        <div class="content-header">
                            <div class="nav-tabs">
                                <a data-id="hot" href="javascript:;" :class="currentTab == 'hot'?`nav-tab active`:`nav-tab`"  @click="handleCurrent('hot')">热门</a>
                                <a data-id="featured" href="javascript:;" :class="currentTab == 'featured'?`nav-tab active`:`nav-tab`"  @click="handleCurrent('featured')">精华</a>
                                <a data-id="all" href="javascript:;" :class="currentTab == 'all'?`nav-tab active`:`nav-tab`"  @click="handleCurrent('all')">所有</a>
                            </div>
                            <div class="nav-right">
                                <div class="date-filter">
                                    <button class="btn dataRange daterange">
                                        <i class="fa fa-calendar glyphicon glyphicon-calendar"></i>
                                        按日期查看
                                    </button>
                                    <input type="hidden" ref="startDate" name="start" value="">
                                    <input type="hidden" ref="endDate" name="end" value="">
                                </div>
                                <div class="sort-filter">
                                    <div class="dropdown">
                                        <button class="btn dropdown-toggle form-control text-left" type="button" id="sortDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                            {{ {latest:'最新发布',likes:'点赞最多',comments:'评论最多',flags:'旗子最多',latest_flags:'最新旗子'}[sortBy] }}
                                            <span class="caret pull-right" style="margin-top:8px"></span>
                                        </button>
                                        <ul class="dropdown-menu" aria-labelledby="sortDropdown">
                                            <li><a href="javascript:;" @click="handleSort('latest')">最新发布</a></li>
                                            <li><a href="javascript:;" @click="handleSort('likes')">点赞最多</a></li>
                                            <li><a href="javascript:;" @click="handleSort('comments')">评论最多</a></li>
                                            <li><a href="javascript:;" @click="handleSort('flags')">旗子最多</a></li>
                                            <li><a href="javascript:;" @click="handleSort('latest_flags')">最新旗子</a></li>
                                        </ul>
                                    </div>
                                </div>
                                <i class="fa fa-th-large search-icon" id="searchShow" @click="handleShow"></i>
                            </div>
                        </div>
                        <div class="content-body">
                            <ul class="article-list">
                                <li class="article-item" v-for="(item,index) in list">
                                    <div class="article-header" @click="handle('/member/index?id='+item.user_id,true)">
                                        <img :src="item.user.avatar?item.user.avatar:`/assets/img/avatar.png`" class="article-avatar" alt="用户头像">
                                        <div class="user-tit">
                                            <div  class="name">
                                                <h3>{{item.user.nickname}}</h3>
                                                <template v-if="item.user.group_image.length>0">
                                                    <img :src="it.image" width="60" height="30" style="margin-left:10px" v-for="(it,id) in item.user.group_image">
                                                </template>
                                            </div>
                                            <div class="time">{{item.createtime}}</div>
                                        </div>
                                    </div>
                                    <div class="article-content" @click="handle('/wdgroup/detail?id='+item.id,false)">
                                        <div style="display: flex; align-items: center; margin-bottom: 12px;" >
                                            <img src="/assets/img/jh.jpg" width="50" height="25" v-if="item.is_featured==1"><div style="font-size: 20px; font-weight: 500;">{{item.title}}</div>
                                        </div>
                                        <span v-if="item.is_shang=='1'">#令牌悬赏#</span> {{item.content}}
                                    </div>
                                    <div class="article-footer">
                                        <div class="article-tags">
                                            <span class="badge" style="cursor: pointer;" v-for="(itm,idx) in item.tags" @click="handle('/wdgroup?wdid='+itm.id,false)"># {{itm.name}}</span> 
                                        </div>
                                        <div class="article-tags">
                                            <span class="badge cate" style="cursor: pointer;" @click="handle('/wdgroup?wdid='+item.category.id,false)"> <img :src="item.category.image?item.category.image:`/assets/img/logo.png`" width="22" height="22"> {{item.category.name}}<span>进入小组查看更多</span></span>
                                        </div>
                                        <div class="article-stats" v-if="user">
                                            <div class="stat-item" @click="showFlag(item.id)">
                                                <i class="fa fa-font-awesome"></i>
                                                <span>{{item.flag}}</span>
                                            </div>
                                            <div class="stat-item" @click="showFollow(item.id)">
                                                <i class="fa fa-thumbs-o-up"></i>
                                                <span>{{item.likes}}</span>
                                            </div>
                                            <div class="stat-item" @click="showComment(item.id)">
                                                <i class="fa fa-commenting-o"></i>
                                                <span>{{item.comments}}</span>
                                            </div>
                                            <div class="stat-item" @click="showFavorites(item.id)">
                                                <i class="fa fa fa-star-o"></i>
                                                <span>{{item.favorites}}</span>
                                            </div>
                                        </div>
                                        <div class="article-stats" v-else>
                                            <div class="stat-item">
                                                <i class="fa fa-font-awesome"></i>
                                                <span>{{item.flag}}</span>
                                            </div>
                                            <div class="stat-item">
                                                <i class="fa fa-thumbs-o-up"></i>
                                                <span>{{item.likes}}</span>
                                            </div>
                                            <div class="stat-item">
                                                <i class="fa fa-commenting-o"></i>
                                                <span>{{item.comments}}</span>
                                            </div>
                                            <div class="stat-item">
                                                <i class="fa fa fa-star-o"></i>
                                                <span>{{item.favorites}}</span>
                                            </div>
                                        </div>
                                        <div class="article-clicks" v-if="item.followlist.length>0">
                                            <i class="fa fa-thumbs-o-up"></i>
                                            <template v-for="(itm,idx) in item.followlist">
                                            <span>{{itm.nickname}}、</span>
                                            </template>
                                            等{{item.likes}}人点赞了这篇文章
                                        </div>
                                        <div class="article-comments" v-if="item.commonslist.length>0">
                                            <div class="comments-list" v-for="(itm,idx) in item.commonslist">
                                                <img :src="item.avatar" width="50" height="50" v-if="itm.avatar">
                                                <div class="comments-item">
                                                    <div class="comments-header">
                                                        <span class="comments-name">{{itm.nickname}}：</span>
                                                        <span class="comments-con">{{itm.content}}</span>
                                                    </div>
                                                    <div class="comments-footer">
                                                        <span class="comments-time">{{itm.create_time}}</span>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="col-md-3 hidden-xs">
                    <div class="sidebar-section">
                        <div class="tab-container">
                            <div class="tab-nav nav-tabs" role="tablist">
                                <a href="javascript:;" :class="articletab == 0?`tab-item active`:`tab-item`" @click="handleArticle(0)">最新文章</a>
                                <a href="javascript:;" :class="articletab == 1?`tab-item active`:`tab-item`" @click="handleArticle(1)">热门文章</a>
                                <a href="javascript:;" :class="articletab == 2?`tab-item active`:`tab-item`" @click="handleArticle(2)">最新旗子</a>
                            </div>
                            <div class="tab-content">
                                <div class="tabcon-list" v-if="article.length > 0">
                                    <template v-for="(item,index) in article" >
                                        <div class="list-item" @click="handle('/index/detail?id='.item.id,true)"><span :class="`num highlight`+(index+1)">{{index+1}}</span>{{item.title}}</div>
                                    </template>
                                    
                                </div>                   
                            </div>
                        </div>
                    </div>
                    <div class="sidebar-section"  style="margin-top: 10px;">
                        <div class="sidebar-footer">
                            <a href="javascript:;" class="sidebar-footer-link" @click="handle('/advisers?wdid={$cate['id']}',true)">
                                <span>相关实战</span>
                                <small>{$adviser}场Ai实战</small>
                            </a>
                            <i class="fa fa-angle-right" style="font-size: 20px;"></i>
                        </div>
                    </div>
                        <div class="sidebar-header" style="margin-top: 10px;">
                            <span>精华帖作者</span>
                        </div>
                        <div class="sidebar-section">
                            <div class="sidebar-item" v-for="item in fuser"  @click="handle('/user/info?id='+item.id,true)">
                                <img :src="item.avatar?item.avatar:`/assets/img/avatar.png`" width="40" height="40">
                                <a href="javascript:;" class="sidebar-link">
                                    <span>{{ item.nickname }}</span>
                                    <span class="badge">获得{{ item.count }}次精华帖</span>
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </div>
</body>
<script src="/assets/js/require.js" data-main="/assets/js/require-frontend.js?v={$site.version|htmlentities}"></script>
</html>
